package Frontera;

import Control.ControlAdministrarProveedor;
import DAO.ProductosProveedorJpaController;
import Entidad.Evaluaciones;
import Entidad.ProductoProveedor;
import Entidad.Proveedores;
import java.util.Vector;
import javax.persistence.EntityManager;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

public class AdministrarProveedor extends javax.swing.JFrame {
    JFrame frame;
    EntityManager em;
    ProductosProveedorJpaController productosProv = new ProductosProveedorJpaController();
    /** Creates new form AdministrarProveedor */
    public AdministrarProveedor() {
        em = Splash.em;
        initComponents();
        listaproductos = Splash.listaproductos;
        jTabbedPane1.addChangeListener(new ChangeListener() {

            public void stateChanged(ChangeEvent e) {
                if(jTabbedPane1.getSelectedIndex() == 0){
                    TFNombreBuscar.setText(null);
                    TFNitBuscar.setText(null);
                    TABuscar.setText(null);
                }
                if(jTabbedPane1.getSelectedIndex() == 1){
                    TFNombreEliminar.setText(null);
                    TFNitEliminar.setText(null);
                    TAEliminar.setText(null);
                }
                if(jTabbedPane1.getSelectedIndex() == 2){
                    TFNombreCrear.setText(null);
                    TFNitCrear.setText(null);
                    TFTelefonoCrear.setText(null);
                    TFRepresentanteCrear.setText(null);
                    TFPagWebCrear.setText(null);
                    TFCorreoCrear.setText(null);
                    TFDireccionCrear.setText(null);
                    Splash.listaproductos = null;
                }
                if(jTabbedPane1.getSelectedIndex() == 3){
                    TFSubNitModificar.setText(null);
                    TFSubNombreModificar.setText(null);
                    TFNombreModificar.setText(null);
                    TFNitModificar.setText(null);
                    TFTelefonoModificar.setText(null);
                    TFRepresentanteModificar.setText(null);
                    TFPagWebModificar.setText(null);
                    TFCorreoModificar.setText(null);
                    TFDireccionModificar.setText(null);
                    Splash.listaproductos = null;

                    TFSubNitModificar.setEnabled(false);
                    TFSubNombreModificar.setEnabled(false);
                    TFTelefonoModificar.setEnabled(false);
                    TFRepresentanteModificar.setEnabled(false);
                    TFPagWebModificar.setEnabled(false);
                    TFCorreoModificar.setEnabled(false);
                    TFDireccionModificar.setEnabled(false);
                    BtnProductosModificar.setEnabled(false);

                    proveedor = new Proveedores();
                }
            }
        });
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lblPrincipal = new javax.swing.JLabel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        PanelTabBuscar = new javax.swing.JPanel();
        BtnBuscarBuscar = new javax.swing.JButton();
        BtnCancelarBuscar = new javax.swing.JButton();
        lblNombreBuscar = new javax.swing.JLabel();
        lblNitBuscar = new javax.swing.JLabel();
        TFNombreBuscar = new javax.swing.JTextField();
        TFNitBuscar = new javax.swing.JTextField();
        jScrollPane1 = new javax.swing.JScrollPane();
        TABuscar = new javax.swing.JTextArea();
        PanelTabEliminar = new javax.swing.JPanel();
        BtnCancelarEliminar = new javax.swing.JButton();
        lblNombreEliminar = new javax.swing.JLabel();
        lblNitEliminar = new javax.swing.JLabel();
        TFNombreEliminar = new javax.swing.JTextField();
        TFNitEliminar = new javax.swing.JTextField();
        BtnVerEliminar = new javax.swing.JButton();
        BtnEliminarEliminar = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        TAEliminar = new javax.swing.JTextArea();
        PanelTabCrear = new javax.swing.JPanel();
        PanelCrear = new javax.swing.JPanel();
        lblNombreCrear = new javax.swing.JLabel();
        lblNitCrear = new javax.swing.JLabel();
        lblRepresentanteCrear = new javax.swing.JLabel();
        lblProductoCrear = new javax.swing.JLabel();
        lblDireccionCrear = new javax.swing.JLabel();
        lblTelefonoCrear = new javax.swing.JLabel();
        lblCorreoCrear = new javax.swing.JLabel();
        lblPagWebCrear = new javax.swing.JLabel();
        TFNombreCrear = new javax.swing.JTextField();
        TFNitCrear = new javax.swing.JTextField();
        TFRepresentanteCrear = new javax.swing.JTextField();
        TFDireccionCrear = new javax.swing.JTextField();
        TFTelefonoCrear = new javax.swing.JTextField();
        TFCorreoCrear = new javax.swing.JTextField();
        TFPagWebCrear = new javax.swing.JTextField();
        BtnProductosCrear = new javax.swing.JButton();
        BtnGuardarCrear = new javax.swing.JButton();
        BtnCancelarCrear = new javax.swing.JButton();
        PanelTabModificar = new javax.swing.JPanel();
        BtnCancelarModificar = new javax.swing.JButton();
        BtnGuardarModificar = new javax.swing.JButton();
        lblNombreModificar = new javax.swing.JLabel();
        lblNitModificar = new javax.swing.JLabel();
        TFNombreModificar = new javax.swing.JTextField();
        TFNitModificar = new javax.swing.JTextField();
        BtnBuscarModificar = new javax.swing.JButton();
        SubPanelModificar = new javax.swing.JPanel();
        lblSubModificar = new javax.swing.JLabel();
        lblSubNit = new javax.swing.JLabel();
        lblRepresentanteModificar = new javax.swing.JLabel();
        lblProductoModificar = new javax.swing.JLabel();
        lblDireccionModificar = new javax.swing.JLabel();
        lblTelefonoModificar = new javax.swing.JLabel();
        lblCorreoModificar = new javax.swing.JLabel();
        lblPagWebModificar = new javax.swing.JLabel();
        TFSubNombreModificar = new javax.swing.JTextField();
        TFSubNitModificar = new javax.swing.JTextField();
        TFRepresentanteModificar = new javax.swing.JTextField();
        TFDireccionModificar = new javax.swing.JTextField();
        TFTelefonoModificar = new javax.swing.JTextField();
        TFCorreoModificar = new javax.swing.JTextField();
        TFPagWebModificar = new javax.swing.JTextField();
        BtnProductosModificar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("SEP - Administración");
        setAlwaysOnTop(true);
        setResizable(false);

        lblPrincipal.setFont(new java.awt.Font("Arial", 1, 14));
        lblPrincipal.setText("Administración de Proveedores");

        jTabbedPane1.setToolTipText("");

        BtnBuscarBuscar.setText("Buscar");
        BtnBuscarBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnBuscarBuscarActionPerformed(evt);
            }
        });

        BtnCancelarBuscar.setText("Cancelar");
        BtnCancelarBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnCancelarBuscarActionPerformed(evt);
            }
        });

        lblNombreBuscar.setText("Nombre");

        lblNitBuscar.setText("NIT");

        TABuscar.setColumns(20);
        TABuscar.setRows(5);
        TABuscar.setAutoscrolls(false);
        TABuscar.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos"));
        jScrollPane1.setViewportView(TABuscar);

        javax.swing.GroupLayout PanelTabBuscarLayout = new javax.swing.GroupLayout(PanelTabBuscar);
        PanelTabBuscar.setLayout(PanelTabBuscarLayout);
        PanelTabBuscarLayout.setHorizontalGroup(
            PanelTabBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelTabBuscarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelTabBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, PanelTabBuscarLayout.createSequentialGroup()
                        .addGroup(PanelTabBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblNombreBuscar)
                            .addComponent(lblNitBuscar))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(PanelTabBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(TFNombreBuscar, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)
                            .addComponent(TFNitBuscar, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)))
                    .addComponent(BtnCancelarBuscar)
                    .addComponent(BtnBuscarBuscar))
                .addContainerGap())
        );
        PanelTabBuscarLayout.setVerticalGroup(
            PanelTabBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelTabBuscarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelTabBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNombreBuscar)
                    .addComponent(TFNombreBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelTabBuscarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TFNitBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblNitBuscar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(BtnBuscarBuscar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 269, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(BtnCancelarBuscar)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Buscar", PanelTabBuscar);

        BtnCancelarEliminar.setText("Cancelar");
        BtnCancelarEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnCancelarEliminarActionPerformed(evt);
            }
        });

        lblNombreEliminar.setText("Nombre");

        lblNitEliminar.setText("NIT");

        BtnVerEliminar.setText("Ver");
        BtnVerEliminar.setActionCommand("jButton7");
        BtnVerEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnVerEliminarActionPerformed(evt);
            }
        });

        BtnEliminarEliminar.setText("Eliminar");
        BtnEliminarEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnEliminarEliminarActionPerformed(evt);
            }
        });

        TAEliminar.setColumns(20);
        TAEliminar.setRows(5);
        TAEliminar.setBorder(javax.swing.BorderFactory.createTitledBorder("Resumen"));
        jScrollPane2.setViewportView(TAEliminar);

        javax.swing.GroupLayout PanelTabEliminarLayout = new javax.swing.GroupLayout(PanelTabEliminar);
        PanelTabEliminar.setLayout(PanelTabEliminarLayout);
        PanelTabEliminarLayout.setHorizontalGroup(
            PanelTabEliminarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelTabEliminarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelTabEliminarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 345, Short.MAX_VALUE)
                    .addComponent(BtnCancelarEliminar)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, PanelTabEliminarLayout.createSequentialGroup()
                        .addGroup(PanelTabEliminarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblNombreEliminar)
                            .addComponent(lblNitEliminar))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(PanelTabEliminarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(TFNombreEliminar, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)
                            .addGroup(PanelTabEliminarLayout.createSequentialGroup()
                                .addGap(156, 156, 156)
                                .addComponent(BtnVerEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(BtnEliminarEliminar))
                            .addComponent(TFNitEliminar, javax.swing.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE))))
                .addContainerGap())
        );
        PanelTabEliminarLayout.setVerticalGroup(
            PanelTabEliminarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelTabEliminarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelTabEliminarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNombreEliminar)
                    .addComponent(TFNombreEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelTabEliminarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TFNitEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblNitEliminar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelTabEliminarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BtnVerEliminar)
                    .addComponent(BtnEliminarEliminar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 269, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(BtnCancelarEliminar)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Eliminar", PanelTabEliminar);

        PanelCrear.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        lblNombreCrear.setText("Nombre:");

        lblNitCrear.setText("NIT:");

        lblRepresentanteCrear.setText("Representante:");

        lblProductoCrear.setText("Productos:");

        lblDireccionCrear.setText("Direccion:");

        lblTelefonoCrear.setText("Telefono:");

        lblCorreoCrear.setText("Correo:");

        lblPagWebCrear.setText("Pagina web:");

        BtnProductosCrear.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Frontera/lupa.png"))); // NOI18N
        BtnProductosCrear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnProductosCrearActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout PanelCrearLayout = new javax.swing.GroupLayout(PanelCrear);
        PanelCrear.setLayout(PanelCrearLayout);
        PanelCrearLayout.setHorizontalGroup(
            PanelCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCrearLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblRepresentanteCrear)
                    .addComponent(lblNitCrear)
                    .addComponent(lblNombreCrear)
                    .addComponent(lblProductoCrear)
                    .addComponent(lblDireccionCrear)
                    .addComponent(lblTelefonoCrear)
                    .addComponent(lblCorreoCrear)
                    .addComponent(lblPagWebCrear))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(TFNombreCrear, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(TFNitCrear, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(TFRepresentanteCrear, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(TFDireccionCrear, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(TFTelefonoCrear, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(TFCorreoCrear, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(TFPagWebCrear, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(BtnProductosCrear, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        PanelCrearLayout.setVerticalGroup(
            PanelCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelCrearLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNombreCrear)
                    .addComponent(TFNombreCrear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNitCrear)
                    .addComponent(TFNitCrear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblRepresentanteCrear)
                    .addComponent(TFRepresentanteCrear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblProductoCrear)
                    .addComponent(BtnProductosCrear, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDireccionCrear)
                    .addComponent(TFDireccionCrear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblTelefonoCrear)
                    .addComponent(TFTelefonoCrear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCorreoCrear)
                    .addComponent(TFCorreoCrear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPagWebCrear)
                    .addComponent(TFPagWebCrear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        BtnGuardarCrear.setText("Guardar");
        BtnGuardarCrear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnGuardarCrearActionPerformed(evt);
            }
        });

        BtnCancelarCrear.setText("Cancelar");
        BtnCancelarCrear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnCancelarCrearActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout PanelTabCrearLayout = new javax.swing.GroupLayout(PanelTabCrear);
        PanelTabCrear.setLayout(PanelTabCrearLayout);
        PanelTabCrearLayout.setHorizontalGroup(
            PanelTabCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelTabCrearLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(PanelCrear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(21, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelTabCrearLayout.createSequentialGroup()
                .addContainerGap(193, Short.MAX_VALUE)
                .addComponent(BtnCancelarCrear)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(BtnGuardarCrear)
                .addGap(20, 20, 20))
        );
        PanelTabCrearLayout.setVerticalGroup(
            PanelTabCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelTabCrearLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(PanelCrear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelTabCrearLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BtnCancelarCrear)
                    .addComponent(BtnGuardarCrear))
                .addContainerGap(116, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Crear", PanelTabCrear);

        BtnCancelarModificar.setText("Cancelar");
        BtnCancelarModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnCancelarModificarActionPerformed(evt);
            }
        });

        BtnGuardarModificar.setText("Guardar");
        BtnGuardarModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnGuardarModificarActionPerformed(evt);
            }
        });

        lblNombreModificar.setText("Nombre");

        lblNitModificar.setText("NIT");

        BtnBuscarModificar.setText("Buscar");
        BtnBuscarModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnBuscarModificarActionPerformed(evt);
            }
        });

        SubPanelModificar.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        lblSubModificar.setText("Nombre:");

        lblSubNit.setText("NIT:");

        lblRepresentanteModificar.setText("Representante:");

        lblProductoModificar.setText("Productos:");

        lblDireccionModificar.setText("Direccion:");

        lblTelefonoModificar.setText("Telefono:");

        lblCorreoModificar.setText("Correo:");

        lblPagWebModificar.setText("Pagina web:");

        BtnProductosModificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Frontera/lupa.png"))); // NOI18N
        BtnProductosModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnProductosModificarActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout SubPanelModificarLayout = new javax.swing.GroupLayout(SubPanelModificar);
        SubPanelModificar.setLayout(SubPanelModificarLayout);
        SubPanelModificarLayout.setHorizontalGroup(
            SubPanelModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SubPanelModificarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(SubPanelModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblRepresentanteModificar)
                    .addComponent(lblSubNit)
                    .addComponent(lblSubModificar)
                    .addComponent(lblProductoModificar)
                    .addComponent(lblDireccionModificar)
                    .addComponent(lblTelefonoModificar)
                    .addComponent(lblCorreoModificar)
                    .addComponent(lblPagWebModificar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(SubPanelModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(TFSubNombreModificar, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(TFSubNitModificar, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(TFRepresentanteModificar, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(TFDireccionModificar, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(TFTelefonoModificar, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(TFCorreoModificar, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(TFPagWebModificar, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addComponent(BtnProductosModificar, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        SubPanelModificarLayout.setVerticalGroup(
            SubPanelModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(SubPanelModificarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(SubPanelModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSubModificar)
                    .addComponent(TFSubNombreModificar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(SubPanelModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSubNit)
                    .addComponent(TFSubNitModificar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(SubPanelModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblRepresentanteModificar)
                    .addComponent(TFRepresentanteModificar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(SubPanelModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(lblProductoModificar)
                    .addComponent(BtnProductosModificar, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(SubPanelModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblDireccionModificar)
                    .addComponent(TFDireccionModificar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(SubPanelModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblTelefonoModificar)
                    .addComponent(TFTelefonoModificar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(SubPanelModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblCorreoModificar)
                    .addComponent(TFCorreoModificar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(SubPanelModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPagWebModificar)
                    .addComponent(TFPagWebModificar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(25, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout PanelTabModificarLayout = new javax.swing.GroupLayout(PanelTabModificar);
        PanelTabModificar.setLayout(PanelTabModificarLayout);
        PanelTabModificarLayout.setHorizontalGroup(
            PanelTabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelTabModificarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelTabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(SubPanelModificar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(PanelTabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelTabModificarLayout.createSequentialGroup()
                            .addComponent(BtnCancelarModificar)
                            .addGap(18, 18, 18)
                            .addComponent(BtnGuardarModificar))
                        .addGroup(PanelTabModificarLayout.createSequentialGroup()
                            .addGroup(PanelTabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(lblNombreModificar)
                                .addComponent(lblNitModificar))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(PanelTabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(TFNitModificar)
                                .addComponent(TFNombreModificar, javax.swing.GroupLayout.DEFAULT_SIZE, 293, Short.MAX_VALUE)
                                .addComponent(BtnBuscarModificar, javax.swing.GroupLayout.Alignment.TRAILING))
                            .addGap(11, 11, 11))))
                .addContainerGap(10, Short.MAX_VALUE))
        );
        PanelTabModificarLayout.setVerticalGroup(
            PanelTabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelTabModificarLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelTabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNombreModificar)
                    .addComponent(TFNombreModificar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(PanelTabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblNitModificar)
                    .addComponent(TFNitModificar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(BtnBuscarModificar)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(SubPanelModificar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelTabModificarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(BtnGuardarModificar)
                    .addComponent(BtnCancelarModificar))
                .addContainerGap())
        );

        jTabbedPane1.addTab("Modificar", PanelTabModificar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(lblPrincipal)
                        .addGap(75, 75, 75))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 370, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblPrincipal)
                .addGap(18, 18, 18)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 441, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void BtnBuscarBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnBuscarBuscarActionPerformed
        if(validarTextFieldBuscar()){
            ControlAdministrarProveedor control = new ControlAdministrarProveedor();
            Proveedores proveedor2 = new Proveedores();
            Integer obj;
            try{
                obj = Integer.parseInt(TFNitBuscar.getText());
            }catch(NumberFormatException ex){
                obj = null;
            }
            proveedor2 = control.buscarProveedor(TFNombreBuscar.getText(), obj);
            String productos = "";
            String evaluaciones = "Calidad\t\tFiabilidad\t\tFecha\n";

        try{
        try{
            for(ProductoProveedor u: proveedor2.getProductos()){
                    productos = productos + u.getNombreProducto() + "\t\t" + u.getPrecioPorUnidad() + "\n";
            }
        }catch(NullPointerException ex){
            productos = "";
        }

        try{
            for(Evaluaciones u: proveedor2.getEvaluaciones()){
                    evaluaciones = evaluaciones + u.getCalidad() + "\t\t" + u.getFiabilidad() + "\t\t"
                            + u.getFecha() + "\n";
                    if(u.getComentarios() != null)
                        evaluaciones = evaluaciones + "Comentario: " + u.getComentarios() + "\n";
            }
        }catch(NullPointerException ex){
            evaluaciones = "Calidad\t\tFiabilidad\t\tFecha\n";
        }
        TABuscar.setText("Nombre: " + proveedor2.getNombre() + "\n" +
                         "Nit: " + proveedor2.getNit() + "\n" +
                         evaluaciones + "\n" +
                         "Representante: " + proveedor2.getRepresentante() + "\n" +
                         "Correo: " + proveedor2.getCorreo() + "\n" +
                         "Telefono: " + proveedor2.getTelefono() + "\n" +
                         "Pagina Web: " + proveedor2.getPaginaWeb() + "\n" +
                         "Productos:\n" +
                         "Nombre\t\t" + "Precio\n" +
                         productos + "\n"
                        );
        }catch(NullPointerException ex){
            TABuscar.setText("No existe");
        }
        }
        else{
            JOptionPane.showMessageDialog(frame, "Error...");
        }
    }//GEN-LAST:event_BtnBuscarBuscarActionPerformed

    private void BtnVerEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnVerEliminarActionPerformed
        if(validarTextFieldEliminar()){
            ControlAdministrarProveedor control = new ControlAdministrarProveedor();
            Proveedores proveedor2 = new Proveedores();
            Integer obj;
            try{
                obj = Integer.parseInt(TFNitEliminar.getText());
            }catch(NumberFormatException ex){
                obj = null;
            }
            proveedor2 = control.buscarProveedor(TFNombreEliminar.getText(), obj);
            String productos = "";
            String evaluaciones = "Calidad\t\tFiabilidad\t\tFecha\n";

            try{
                try{
                    for(ProductoProveedor u: proveedor2.getProductos()){
                        productos = productos + u.getNombreProducto() + "\t\t" + u.getPrecioPorUnidad() + "\n";
                    }
                }catch(NullPointerException ex){
                    productos = "";
                }
                try{
                    for(Evaluaciones u: proveedor2.getEvaluaciones()){
                        evaluaciones = evaluaciones + u.getCalidad() + "\t\t" + u.getFiabilidad() + "\t\t"
                            + u.getFecha() + "\n";
                    if(u.getComentarios() != null)
                        evaluaciones = evaluaciones + "Comentario: " + u.getComentarios() + "\n";
                    }
                }catch(NullPointerException ex){
                    evaluaciones = "Calidad\t\tFiabilidad\t\tFecha\n";
                }

                TAEliminar.setText("Nombre: " + proveedor2.getNombre() + "\n" +
                             "Nit: " + proveedor2.getNit() + "\n" +
                            evaluaciones + "\n" +
                             "Representante: " + proveedor2.getRepresentante() + "\n" +
                             "Correo: " + proveedor2.getCorreo() + "\n" +
                             "Telefono: " + proveedor2.getTelefono() + "\n" +
                             "Pagina Web: " + proveedor2.getPaginaWeb() + "\n" +
                             "Productos:\n" +
                             "Nombre\t\t" + "Precio\n" +
                              productos + "\n"
                        );
                }catch(NullPointerException ex){
                    TAEliminar.setText("No existe");
                }
        }
        else{
            JOptionPane.showMessageDialog(frame, "Error...");
        }
    }//GEN-LAST:event_BtnVerEliminarActionPerformed

    private void BtnEliminarEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnEliminarEliminarActionPerformed
        ControlAdministrarProveedor control = new ControlAdministrarProveedor();
        String result = control.borrarProveedor(TFNombreEliminar.getText(), Integer.parseInt(TFNitEliminar.getText()));
        if(result.equals("Succes")){
            this.setVisible(false);
            JOptionPane.showMessageDialog(frame, "El Proveedor se ha\nBorrado con exito");
            Principal regresar = new Principal(Login.roll);
            regresar.setLocationRelativeTo(null);
            regresar.setVisible(true);
            this.dispose();
        }
        if(result.equals("Fallo")){
            JOptionPane.showMessageDialog(frame, "El Proveedor no se ha\nEncontrado");
        }
    }//GEN-LAST:event_BtnEliminarEliminarActionPerformed

    private void BtnGuardarCrearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnGuardarCrearActionPerformed
        if(validarTextFieldCrear()){
            ControlAdministrarProveedor control = new ControlAdministrarProveedor();
            Integer obj;
            try{
                obj = Integer.parseInt(TFNitCrear.getText());
            }catch(NumberFormatException ex){
                obj = null;
            }
            
                Proveedores proveedor2 = new Proveedores();

                proveedor2.setNombre(TFNombreCrear.getText());
                proveedor2.setNit(Integer.parseInt(TFNitCrear.getText()));
                proveedor2.setDireccion(TFDireccionCrear.getText());
                proveedor2.setCorreo(TFCorreoCrear.getText());
                proveedor2.setRepresentante(TFRepresentanteCrear.getText());
                proveedor2.setPaginaWeb(TFPagWebCrear.getText());
                proveedor2.setTelefono(Integer.parseInt(TFTelefonoCrear.getText()));
                proveedor2.setProductos(null);

                String result = control.crearProveedor(proveedor2, Splash.listaproductos);
                
                if(result.equals("Succes")){
                    this.setVisible(false);
                    JOptionPane.showMessageDialog(frame, "El Proveedor se ha\nCreado con exito");
                    Principal regresar = new Principal(Login.roll);
                    regresar.setLocationRelativeTo(null);
                    regresar.setVisible(true);
                    this.dispose();
                }
                if(result.equals("Telefono invalido")){
                    JOptionPane.showMessageDialog(frame, "El Telefono es invalido");
                }
                if(result.equals("Nit invalido")){
                    JOptionPane.showMessageDialog(frame, "El Nit es invalido");
                }
        }
        else{
            JOptionPane.showMessageDialog(frame, "Datos Incorrectos");
        }
    }//GEN-LAST:event_BtnGuardarCrearActionPerformed

    private void BtnCancelarCrearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnCancelarCrearActionPerformed
        Principal regresar = new Principal(Login.roll);
        regresar.setLocationRelativeTo(null);
        regresar.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_BtnCancelarCrearActionPerformed

    private void BtnCancelarEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnCancelarEliminarActionPerformed
        Principal regresar = new Principal(Login.roll);
        regresar.setLocationRelativeTo(null);
        regresar.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_BtnCancelarEliminarActionPerformed

    private void BtnCancelarBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnCancelarBuscarActionPerformed
        Principal regresar = new Principal(Login.roll);
        regresar.setLocationRelativeTo(null);
        regresar.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_BtnCancelarBuscarActionPerformed

    private void BtnCancelarModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnCancelarModificarActionPerformed
        Principal regresar = new Principal(Login.roll);
        regresar.setLocationRelativeTo(null);
        regresar.setVisible(true);
        this.dispose();
    }//GEN-LAST:event_BtnCancelarModificarActionPerformed

    private void BtnGuardarModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnGuardarModificarActionPerformed
        if(validarTextFieldModificar()){
            ControlAdministrarProveedor control = new ControlAdministrarProveedor();
            Integer obj;
            try{
                obj = Integer.parseInt(TFSubNitModificar.getText());
            }catch(NumberFormatException ex){
                obj = null;
            }
            if(control.buscarProveedor(obj) == null || (Integer)obj== proveedor.getNit() ){
                Proveedores proveedor2 = new Proveedores();

                proveedor2.setNombre(TFSubNombreModificar.getText());
                proveedor2.setNit(Integer.parseInt(TFSubNitModificar.getText()));
                proveedor2.setDireccion(TFDireccionModificar.getText());
                proveedor2.setCorreo(TFCorreoModificar.getText());
                proveedor2.setRepresentante(TFRepresentanteModificar.getText());
                proveedor2.setPaginaWeb(TFPagWebModificar.getText());
                proveedor2.setTelefono(Integer.parseInt(TFTelefonoModificar.getText()));
                String result = control.modificarProveedor(proveedor, proveedor2, Splash.listaproductos);
                if (!(Splash.listaproductos == null))
                    Splash.listaproductos = null;

                if(result.equals("Succes")){
                    this.setVisible(false);
                    JOptionPane.showMessageDialog(frame, "El Proveedor se ha\nCreado con exito");
                    Principal regresar = new Principal(Login.roll);
                    regresar.setLocationRelativeTo(null);
                    regresar.setVisible(true);
                    this.dispose();
                }
                if(result.equals("Telefono invalido")){
                    JOptionPane.showMessageDialog(frame, "El Telefono es invalido");
                }
                if(result.equals("Nit invalido")){
                    JOptionPane.showMessageDialog(frame, "El Nit es invalido");
                }
            }
            else{
                JOptionPane.showMessageDialog(frame, "Un Proveedor Con ese Nit\n ya se Encuentra en la Base");
            }
        }
        else{
            JOptionPane.showMessageDialog(frame, "Hay Datos invalidos", "Alerta", JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_BtnGuardarModificarActionPerformed

    private void BtnBuscarModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnBuscarModificarActionPerformed
        if(validarTextFieldModificarVer()){
            ControlAdministrarProveedor control = new ControlAdministrarProveedor();
            Integer obj;
            try{
                obj = Integer.parseInt(TFNitModificar.getText());
            }catch(NumberFormatException ex){
                obj = null;
            }
            
            proveedor = control.buscarProveedor(TFNombreBuscar.getText(), obj);
            if(proveedor != null){

                TFSubNitModificar.setEnabled(true);
                TFSubNombreModificar.setEnabled(true);
                TFTelefonoModificar.setEnabled(true);
                TFRepresentanteModificar.setEnabled(true);
                TFPagWebModificar.setEnabled(true);
                TFCorreoModificar.setEnabled(true);
                TFDireccionModificar.setEnabled(true);
                BtnProductosModificar.setEnabled(true);

                TFSubNombreModificar.setText(proveedor.getNombre());
                TFSubNitModificar.setText(String.valueOf(proveedor.getNit()));
                TFRepresentanteModificar.setText(proveedor.getRepresentante());
                TFDireccionModificar.setText(proveedor.getDireccion());
                TFTelefonoModificar.setText(String.valueOf(proveedor.getTelefono()));
                TFCorreoModificar.setText(proveedor.getCorreo());
                TFPagWebModificar.setText(proveedor.getPaginaWeb());
                Vector lista = new Vector();
                for(ProductoProveedor u: proveedor.getProductos()){
                    Vector aux = new Vector();
                    aux.add(u.getNombreProducto());
                    aux.add(u.getPrecioPorUnidad());
                    lista.add(aux);
                }
                Splash.listaproductos = lista;
            }else{
                JOptionPane.showMessageDialog(frame, "El proveedor no existe");
            }
        }
        else{
            JOptionPane.showMessageDialog(frame, "Datos Invalidos");
        }
    }//GEN-LAST:event_BtnBuscarModificarActionPerformed

    private void BtnProductosModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnProductosModificarActionPerformed
        ProductoProveedorInterfaz interfazProductos;
        
        if(Splash.listaproductos == (null)){
            interfazProductos = new ProductoProveedorInterfaz(productosProv);
        }else{
            interfazProductos = new ProductoProveedorInterfaz(Splash.listaproductos);
        }
        interfazProductos.setLocationRelativeTo(this);
        interfazProductos.setAlwaysOnTop(true);
        interfazProductos.setVisible(true);        
    }//GEN-LAST:event_BtnProductosModificarActionPerformed

    private void BtnProductosCrearActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnProductosCrearActionPerformed
        ProductoProveedorInterfaz interfazProductos = new ProductoProveedorInterfaz(Splash.listaproductos);
        interfazProductos.setLocationRelativeTo(this);
        interfazProductos.setAlwaysOnTop(true);
        interfazProductos.setVisible(true);
    }//GEN-LAST:event_BtnProductosCrearActionPerformed

    private boolean validarTextFieldBuscar(){
        boolean integer = true;
        try{
            Integer.parseInt(TFNitBuscar.getText());
        }catch(NumberFormatException ex){
            integer = false;
        }
        return (!TFNombreBuscar.getText().isEmpty() || integer);
    }

    private boolean validarTextFieldModificarVer(){
        boolean integer = true;
        try{
            Integer.parseInt(TFNitModificar.getText());
        }catch(NumberFormatException ex){
            integer = false;
        }
        return (!TFNombreModificar.getText().isEmpty() || integer);
    }

    private boolean validarTextFieldEliminar(){
        boolean integer = true;
        try{
            Integer.parseInt(TFNitEliminar.getText());
        }catch(NumberFormatException ex){
            integer = false;
        }
        return (!TFNombreEliminar.getText().isEmpty() || integer);
    }

    private boolean validarTextFieldCrear(){
        boolean nit = true;
        boolean tel = true;
        try{
            Integer.parseInt(TFNitCrear.getText());
        }catch(NumberFormatException ex){
            nit = false;
        }
        try{
            Integer.parseInt(TFTelefonoCrear.getText());
        }catch(NumberFormatException ex){
            tel = false;
        }

        return (!TFNombreCrear.getText().isEmpty() && nit && !TFNitCrear.getText().isEmpty() && tel);
    }

    private boolean validarTextFieldModificar(){
        boolean nit = true;
        boolean tel = true;
        try{
            Integer.parseInt(TFSubNitModificar.getText());
        }catch(NumberFormatException ex){
            nit = false;
        }
        try{
            Integer.parseInt(TFTelefonoModificar.getText());
        }catch(NumberFormatException ex){
            tel = false;
        }
        return (!TFSubNombreModificar.getText().isEmpty() && nit && !TFSubNitModificar.getText().isEmpty() && tel);
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BtnBuscarBuscar;
    private javax.swing.JButton BtnBuscarModificar;
    private javax.swing.JButton BtnCancelarBuscar;
    private javax.swing.JButton BtnCancelarCrear;
    private javax.swing.JButton BtnCancelarEliminar;
    private javax.swing.JButton BtnCancelarModificar;
    private javax.swing.JButton BtnEliminarEliminar;
    private javax.swing.JButton BtnGuardarCrear;
    private javax.swing.JButton BtnGuardarModificar;
    private javax.swing.JButton BtnProductosCrear;
    private javax.swing.JButton BtnProductosModificar;
    private javax.swing.JButton BtnVerEliminar;
    private javax.swing.JPanel PanelCrear;
    private javax.swing.JPanel PanelTabBuscar;
    private javax.swing.JPanel PanelTabCrear;
    private javax.swing.JPanel PanelTabEliminar;
    private javax.swing.JPanel PanelTabModificar;
    private javax.swing.JPanel SubPanelModificar;
    private javax.swing.JTextArea TABuscar;
    private javax.swing.JTextArea TAEliminar;
    private javax.swing.JTextField TFCorreoCrear;
    private javax.swing.JTextField TFCorreoModificar;
    private javax.swing.JTextField TFDireccionCrear;
    private javax.swing.JTextField TFDireccionModificar;
    private javax.swing.JTextField TFNitBuscar;
    private javax.swing.JTextField TFNitCrear;
    private javax.swing.JTextField TFNitEliminar;
    private javax.swing.JTextField TFNitModificar;
    private javax.swing.JTextField TFNombreBuscar;
    private javax.swing.JTextField TFNombreCrear;
    private javax.swing.JTextField TFNombreEliminar;
    private javax.swing.JTextField TFNombreModificar;
    private javax.swing.JTextField TFPagWebCrear;
    private javax.swing.JTextField TFPagWebModificar;
    private javax.swing.JTextField TFRepresentanteCrear;
    private javax.swing.JTextField TFRepresentanteModificar;
    private javax.swing.JTextField TFSubNitModificar;
    private javax.swing.JTextField TFSubNombreModificar;
    private javax.swing.JTextField TFTelefonoCrear;
    private javax.swing.JTextField TFTelefonoModificar;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JLabel lblCorreoCrear;
    private javax.swing.JLabel lblCorreoModificar;
    private javax.swing.JLabel lblDireccionCrear;
    private javax.swing.JLabel lblDireccionModificar;
    private javax.swing.JLabel lblNitBuscar;
    private javax.swing.JLabel lblNitCrear;
    private javax.swing.JLabel lblNitEliminar;
    private javax.swing.JLabel lblNitModificar;
    private javax.swing.JLabel lblNombreBuscar;
    private javax.swing.JLabel lblNombreCrear;
    private javax.swing.JLabel lblNombreEliminar;
    private javax.swing.JLabel lblNombreModificar;
    private javax.swing.JLabel lblPagWebCrear;
    private javax.swing.JLabel lblPagWebModificar;
    private javax.swing.JLabel lblPrincipal;
    private javax.swing.JLabel lblProductoCrear;
    private javax.swing.JLabel lblProductoModificar;
    private javax.swing.JLabel lblRepresentanteCrear;
    private javax.swing.JLabel lblRepresentanteModificar;
    private javax.swing.JLabel lblSubModificar;
    private javax.swing.JLabel lblSubNit;
    private javax.swing.JLabel lblTelefonoCrear;
    private javax.swing.JLabel lblTelefonoModificar;
    // End of variables declaration//GEN-END:variables
    Proveedores proveedor = new Proveedores();
    Vector listaproductos;
}